/**
 * 订单管理
 */
import request from '@/utils/request'

export default {
  // 后台平台订单列表 - 分页
  getList (data) {
    return request({
      url: '/sot-admin-api/order/query/queryOrderList',
      method: 'post',
      data: {
        ...data,
        orderBy: 'order_time desc' //按订单下单倒顺排序
      }
    })
  },
  // 订单各状态数量
  getStatusCount (data) {
    return request({
      url: '/sot-admin-api/order/query/queryStatusCount',
      method: 'post',
      data
    })
  },
  // 获取订单详情
  getOrderInfo (data) {
    return request({
      url: '/sot-admin-api/order/query/queryOrder',
      method: 'post',
      data
    })
  },
  // 订单列表下载
  downloadOrderList (data) {
    return request({
      url: '/sot-admin-api/order/query/downloadOrderList',
      method: 'get',
      data
    })
  },
  // 拒绝退款
  refusalRefund (data) {
    return request({
      url: '/sot-admin-api/order/refund/refuseRefundApply',
      method: 'post',
      data
    })
  },
  // 同意退款
  agreeRefund (data) {
    return request({
      url: '/sot-admin-api/order/refund/acceptRefundApply',
      method: 'post',
      data
    })
  },
  // 酒店确认预订
  acceptOrder (data) {
    return request({
      url: '/sot-admin-api/order/order/acceptOrder',
      method: 'post',
      data
    })
  },
  // 退款失败 - 手动退款
  refund (data) {
    return request({
      url: '/sot-admin-api/order/refund/platformRefund',
      method: 'post',
      data
    })
  },
  // 拒绝预订、拒绝发货退款
  refuseOrderRefund (data) {
    return request({
      url: '/sot-admin-api/order/order/refuseOrderRefund',
      method: 'post',
      data
    })
  },
  // 商户后台主动完成订单
  completeOrder (data) {
    return request({
      url: '/sot-admin-api/order/order/completeOrder',
      method: 'post',
      data
    })
  },
  // 发货
  deliver (data) {
    return request({
      url: '/sot-admin-api/order/order/goodsDeliver',
      method: 'post',
      data
    })
  },
  // 修改发货
  modifyDeliver (data) {
    return request({
      url: '/sot-admin-api/order/order/modifyDeliver',
      method: 'post',
      data
    })
  },
  // 查询所有快递公司
  expressCompany (data) {
    return request({
      url: '/sot-admin-api/fundamental/express/queryExpressCompany',
      method: 'post',
      data
    })
  },
  // 查询快递信息
  queryExpress (data) {
    return request({
      url: '/sot-admin-api/fundamental/express/queryExpress',
      method: 'post',
      data
    })
  },
  // 所属店铺 - 查询下拉
  getSubmerchant (data) {
    return request({
      url: '/sot-admin-api/merchant/sub/queryListForMch',
      method: 'post',
      data
    })
  },
  // 平台 - 销售商户 - 查询下拉
  getSaleMerchant (data) {
    return request({
      url: '/sot-admin-api/merchant/merchant/querySellMchList',
      method: 'post',
      data
    })
  },
  // 企业 - 销售商户 - 查询下拉
  getSaleMerchantForMerchant (data) {
    return request({
      url: '/sot-admin-api/merchant/merchant/querySellMchList',
      method: 'post',
      data
    })
  },
  // 退款记录
  queryRefundApplyHistory (data) {
    return request({
      url: '/sot-admin-api/order/refund/queryRefundApplyHistory',
      method: 'post',
      data
    })
  },
  // 退款短信验证码
  refundPhoneValidatorCode (data) {
    return request({
      url: '/sot-admin-api/order/order/refundPhoneValidatorCode',
      method: 'post',
      data
    })
  },
  //手动分账
  separateAccount (data) {
    return request({
      url: '/sot-admin-api/order/order/distribute',
      method: 'post',
      data
    })
  }
}
